import {FileValidator} from "./file-validator";
import {BadRequestException} from "@nestjs/common";

export class MaxFileSizeValidator extends FileValidator{
    isValid(file?: any): boolean | Promise<boolean> {
        if(file.size > this.validationOptions.maxSize){
            throw new BadRequestException(`validation failed (expected size is ${this.validationOptions.maxSize})`);
        }
        return true;
    }
}
